package alternateDigitSum;

public class Solution {
    public int alternateDigitSum(int n) {
        int res=0;
        int neg=1;
        while(n>0){
            res+=n%10*neg;
            neg*=-1;
            n/=10;
        }
        return res;
    }
}
